const fs = require('fs');
const less = require('less');

fs.readFile('./src/less/style.less', 'utf-8', (err, style) => {
    if (err) {
        console.log(err)
        console.log('读取less文件失败')
    } else {
        less.render(style.toString(), (err, output) => {
            if (err) {
                console.log('less编译失败')
            } else {
                fs.writeFile('./src/css/style.min.css', output.css, err => {
                    if (err) {
                        console.log('写入失败')
                    }
                })
            }
        })
    }
})